package homework.four_one;

import java.io.*;

class SuperClass
{
    int x;
    SuperClass()
    {
        x=3;
        System.out.println("In SuperClass : x="+x);
    }
    void doSomething()
    {
        System.out.println("in SuperClass.dosomething()");
    }
}

class SubClass extends SuperClass
{
    int x;
    SubClass()
    {
        super();      //super() 要放在方法的第一句
        x=5;
        System.out.println("int SubClass :x="+x);
    }
    void doSomething()
    {
        super.doSomething();
        System.out.println("in SubClass.doSomething()");
        System.out.println("super.x="+super.x+"sub.x="+x);
    }
}


public class Inhertance {
    public static void main(String args[])
    {
        SubClass subC=new SubClass();
        subC.doSomething();
    }
}
